www.gusucode.com > vc++ 远程控制示例源程序-源码程序 > vc++ 远程控制示例源程序-源码程序\code\PeerYouC\PeerMessageListView.cpp
// PeerMessageListView.cpp : implementation file // Download by http://www.NewXing.com #include "stdafx.h" #include "PeerYouC.h" #include "PeerMessageListView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CPeerMessageListView IMPLEMENT_DYNCREATE(CPeerMessageListView, CListView) CPeerMessageListView::CPeerMessageListView() { } CPeerMessageListView::~CPeerMessageListView() { } BEGIN_MESSAGE_MAP(CPeerMessageListView, CListView) //{{AFX_MSG_MAP(CPeerMessageListView) ON_WM_CREATE() ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPeerMessageListView drawing void CPeerMessageListView::OnDraw(CDC* pDC) { CDocument* pDoc = GetDocument(); // TODO: add draw code here } ///////////////////////////////////////////////////////////////////////////// // CPeerMessageListView diagnostics #ifdef _DEBUG void CPeerMessageListView::AssertValid() const { CListView::AssertValid(); } void CPeerMessageListView::Dump(CDumpContext& dc) const { CListView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CPeerMessageListView message handlers int CPeerMessageListView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CListView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here CListCtrl &listCtrl=this->GetListCtrl(); listCtrl.SetBkColor(RGB(0,0,0)); listCtrl.SetTextColor(RGB(255,0,0)); listCtrl.SetTextBkColor(RGB(0,0,0)); listCtrl.ModifyStyle(0,LVS_REPORT|LVS_SINGLESEL); ////////////////////////////////////////////////// LVCOLUMN colinfo; memset(&colinfo,0,sizeof(colinfo)); colinfo.mask=/*LVCF_WIDTH|LVCF_FMT|LVCF_IMAGE|LVCF_ORDER |LVCF_SUBITEM|*/LVCF_TEXT; // colinfo.fmt=LVCFMT_IMAGE|LVCFMT_RIGHT|LVCFMT_COL_HAS_IMAGES|LVCFMT_CENTER; colinfo.cx=100; colinfo.cchTextMax=255; colinfo.pszText="状态"; colinfo.iSubItem=0; colinfo.iImage=0; colinfo.iOrder=0; listCtrl.InsertColumn(0,&colinfo); colinfo.pszText="执行命令"; colinfo.iSubItem=1; colinfo.iImage=0; colinfo.iOrder=1; listCtrl.InsertColumn(1,&colinfo); colinfo.pszText="目的主机"; colinfo.iSubItem=2; colinfo.iImage=0; colinfo.iOrder=2; listCtrl.InsertColumn(2,&colinfo); colinfo.pszText="完成时间"; colinfo.iSubItem=3; colinfo.iImage=0; colinfo.iOrder=3; listCtrl.InsertColumn(3,&colinfo); return 0; } void CPeerMessageListView::OnSize(UINT nType, int cx, int cy) { CListView::OnSize(nType, cx, cy); // TODO: Add your message handler code here CListCtrl &listCtrl=this->GetListCtrl(); LVCOLUMN colinfo; colinfo.mask=LVCF_WIDTH/*|LVCF_FMT|LVCF_IMAGE|LVCF_ORDER |LVCF_SUBITEM |LVCF_TEXT*/; colinfo.cx=38; listCtrl.SetColumn(0,&colinfo); colinfo.cx=(cx-20)/3; for(int i=1;i<4;i++) listCtrl.SetColumn(i,&colinfo); }